Add checks for invalid formats given to -i I -o O inputfile outputfile form of comman...
authorrobertl <robertl>
Thu, 2 Jul 2009 17:37:18 +0000 (17:37 +0000)
committerrobertl <robertl>
Thu, 2 Jul 2009 17:37:18 +0000 (17:37 +0000)
main.c

diff --git a/main.c b/main.c
index ea26c617be4bd48d78bc745bb0a2567ad73e4d1c..778d6874322ac1b2de2a8ce31356a9b725d6dc64 100644 (file)
--- a/main.c
+++ b/main.c
@@ -577,6 +577,9 @@ main(int argc, char *argv[])
                cet_convert_init(ivecs->encode, 1);
 
                start_session(ivecs->name, argv[0]);
+               if (ivecs->rd_init == NULL) {
+                       fatal ("Format does not support reading.\n");
+               }
                ivecs->rd_init(argv[0]);
                ivecs->read();
                ivecs->rd_deinit();
@@ -588,6 +591,10 @@ main(int argc, char *argv[])
                {
                        cet_convert_init(ovecs->encode, 1);
                        cet_convert_strings(NULL, global_opts.charset, NULL);
+
+                       if (ovecs->wr_init == NULL) {
+                               fatal ("Format does not support writing.\n");
+                       }
                        
                        ovecs->wr_init(argv[1]);
                        ovecs->write();